#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>

int main()
{
	double price = 0.0;
	int month = 0;
	int day = 0;
	int coupon = 0;

	scanf("%lf", &price);
	scanf("%d", &month);
	scanf("%d", &day);
	scanf("%d", &coupon);

	if (11 == month && 11 == day)
	{
		price = 0.7*price - 50*coupon;

	}
	else if (12 == month && 12 == day)
	{
		price = 0.8 * price - 50 * coupon;
	}

	if (price > 0)
		printf("%.2f", price);
	else
		printf("%.2f", 0.00);

	return 0;
}